<template>
  <div class="box">
    <div class="top" v-show="showTop">
      <div class="head">
        <span>完成基本信息填写与认证,即将开启</span>
        <span class="word">招聘之旅</span>
      </div>
      <!-- 进度条 -->
      <div class="progress_bar">
        <el-steps :active="active" finish-status="success">
          <el-step title="基础信息"></el-step>
          <el-step title="认证"></el-step>
          <el-step title="完成"></el-step>
        </el-steps>
        <el-button style="margin-top: 12px" @click="next" v-show="active != 2"
          >下一步</el-button
        >
        <el-button style="margin-top: 12px" @click="last" v-show="active == 2"
          >上一步</el-button
        >
      </div>
    </div>
    <div class="main" v-show="showMain">
      <div class="contentOne" v-show="active == 0">
        <!-- 内容 -->
        <div class="content">
          <div class="title">
            <span class="bar"></span>
            <span>基础信息</span>
          </div>
          <div class="form">
            <div class="left">
              <label for="comName"><span>*</span>企业名称</label>
              <input
                v-model="comName"
                type="text"
                name="comName"
                required=""
                autocomplete="off"
                class="input"
                placeholder="请输入企业全称-需与营业执照保持一致"
              />
              <label for="personName"><span>*</span>姓名</label>
              <input
                v-model="personName"
                type="text"
                name="personName"
                required=""
                autocomplete="off"
                class="input"
                placeholder="请输入真实姓名"
              />
            </div>
            <div class="right">
              <label for="scale"><span>*</span>公司规模</label>
              <input
                v-model="scale"
                type="text"
                name="scale"
                required=""
                autocomplete="off"
                class="input"
                placeholder="请输入公司规模"
              />
              <!-- <label for="position"><span>*</span>职称</label>
              <input
                v-model="position"
                type="text"
                name="position"
                required=""
                autocomplete="off"
                class="input"
                placeholder="请选择职称"
              /> -->
              <label for="position"><span>*</span>职称</label>
              <div class="like-input" style="dispaly: inline-block; width: 92%">
                <el-form style="dispaly: inline-block; width: 100%">
                  <el-select
                    v-model="form.region"
                    placeholder="请选择您的职位"
                    style="dispaly: inline-block; width: 100%"
                  >
                    <el-option label="HR" value="shanghai"></el-option>
                    <el-option label="总裁" value="beijing"></el-option>
                  </el-select>
                </el-form>
              </div>
            </div>
          </div>
          <!-- 联系人 -->
        </div>
        <div class="content">
          <div class="title">
            <span class="bar"></span>
            <span>联系方式</span>
          </div>
          <div class="form">
            <div class="left">
              <label for="phone"><span>*</span>电话</label>
              <input
                v-model="phone"
                type="text"
                name="phone"
                required=""
                autocomplete="off"
                class="input"
              />
            </div>

            <div class="right">
              <label for="email"><span>*</span>电子邮箱</label>
              <input
                v-model="email"
                type="text"
                name="email"
                required=""
                autocomplete="off"
                class="input"
              />
            </div>
          </div>
        </div>
      </div>
      <!-- 第二部分 -->
      <div class="contenTwo" v-show="active == 1">
        <div class="identify">
          <!-- 展示信息 -->
          <div class="words">
            <span>企业信息认证</span>
            <span class="ray">（为保证求职者信息安全，请您选择以下</span>
            <span class="red">任意一种方式</span>
            <span class="ray">进行企业认证，否则将无法获取联系方式。)</span>
          </div>
          <!-- 认证信息 -->
          <div class="main_box">
            <div class="content_box" @click="toBusinessIdentify">
              <div class="img">
                <img src="../../assets/img/identify.png" alt="" />
              </div>
              <div class="inner_box">
                <div class="big_words">营业执照认证</div>
                <div class="small_words">
                  请上传清晰且未遮挡的企业营业执照认证
                </div>
                <button class="button">我要认证</button>
              </div>
            </div>
            <div class="content_box" @click="toMyLicense">
              <div class="img">
                <img src="../../assets/img/identify.png" alt="" />
              </div>
              <div class="inner_box">
                <div class="big_words">个人名片认证</div>
                <div class="small_words">
                  请上传您的名片并与身份证正面摆在一起拍摄
                </div>
                <button class="button">我要认证</button>
              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- 第三部分完成认证 -->
      <div class="contenThree" v-show="active == 2">
        <div class="success_box">
          <div class="img"></div>
          <div class="words">
            点击<span class="button_words" @click="toHome">立即体验</span
            >后即将进入企业管理
          </div>
          <div class="words">您的基础信也会自动提交~</div>
          <div class="words">祝您招聘愉快~~</div>
        </div>
      </div>
      <!-- 底部按钮部分 -->
      <div v-show="showTop">
        <div class="bottom" @click="next" v-show="active == 0">下一步</div>
        <div class="bottom_new" v-show="active != 0 && active != 2">
          <div @click="last" class="last">上一步</div>
          <div @click="next" class="next">下一步</div>
        </div>
        <!-- <div class="bottom_last" @click=" @click='toHome'" v-show="active == 2">
          立即体验
        </div> -->
        <div class="bottom_new" v-show="active == 2">
          <div @click="last" class="last">上一步</div>
          <div @click="toHome" class="next">立即体验</div>
        </div>
      </div>
    </div>

    <!-- 认证部分 -->
    <div class="identify_box" v-show="showBusinessLic">
      <!-- 上面部分 -->
      <div class="title">营业执照认证</div>
      <div class="subTitle">
        <span
          style="color: color: #888;font-size:14px;font-weight:normal;float:right "
          >取消认证？
          <span class="return" @click="toReturn">返回上级</span>
        </span>
      </div>

      <div class="box_left" v-show="!showSuccess">
        <div class="box_inter" @click="pickOne" v-show="pImage">
          <div class="add" @change="changeImage($event)">
            <!-- <img src="../../assets/img/add.png" alt="" /> -->
          </div>
          <div class="inter_words">图片请上传您的营业执照</div>
          <div class="inter_words">(用鼠标单击选择电脑上的图片)</div>
        </div>
        <!-- 提交照片 -->
        <img :src="avatar" class="imageInfo" v-show="showPImage" />
        <div class="box-bottom">
          <div class="choose">
            <input
              type="file"
              name="avatar"
              id="uppic"
              accept="image/gif,image/jpeg,image/jpg,image/png"
              @change="changeImage($event)"
              ref="avatarInput"
              class="chooseButton"
            />
          </div>

          <div class="button" @click="submitImage">确认提交</div>
        </div>
      </div>
      <!-- 营业执照图片上传 -->

      <div class="box_right" v-show="!showSuccess">
        <div class="words">
          1.
          请将您的营业执照摆放平整拍摄，拍照时要确保对焦点置于营业执照上，保证营业执照信息清晰且未遮挡;
        </div>
        <div class="words">2. 上传文件格式仅支持png或jpg;</div>
        <div class="words">
          3. 所有上传信息我们均会妥善保管，不会用于其他商业用途或传输给第三方。
        </div>
      </div>
      <div v-show="showSuccess">
        <div class="successSubmit_box">
          <div class="img"></div>
          <div class="words">您的认证信息我们将会进行人工审核</div>
          <!-- <div class="words">您的基础信也会自动提交~</div> -->
          <div class="words">请耐心等待~</div>
        </div>
      </div>
    </div>
    <!-- 名片认证 -->
    <div class="identify_box" v-if="showMyLic">
      <div class="title">名片认证</div>
      <div class="subTitle">
        <span
          style="color: color: #888;font-size:14px;font-weight:normal;float:right "
          >取消认证？
          <span class="return" @click="toReturn">返回上级</span>
        </span>
      </div>

      <div class="box_left" v-show="!showSuccess">
        <div class="box_inter" @click="pickTwo" v-show="personImage">
          <div class="add"></div>
          <div class="inter_words">
            图片请上传您的名片和身份证正面（在一张图片上显示）
          </div>
          <div class="inter_words">(用鼠标单击选择电脑上的图片)</div>
        </div>
        <img :src="avatar" class="imageInfo" v-show="showPersonImage" />
        <div class="box-bottom">
          <div class="choose">
            <!-- <input
              type="file"
              name="avatar"
              id="uppic"
              accept="image/gif,image/jpeg,image/jpg,image/png"
              @change="changeImage($event)"
              ref="avatarInput"
              class="chooseButton"
             
            /> -->
            <div class="file-box">
              <input
                class="file-btn"
                type="file"
                name="avatar"
                id="uppic"
                accept="image/gif,image/jpeg,image/jpg,image/png"
                @change="changeImage($event)"
                ref="avatarInput"
              />
              上传文件
            </div>
          </div>
          <div class="button" @click="submitImage">确认提交</div>
        </div>
      </div>

      <div class="box_right" v-show="!showSuccess">
        <div class="words">1. 拍照时要确保两者的信息都清晰且未遮挡;</div>
        <div class="words">2. 上传文件格式仅支持png或jpg;</div>
        <div class="words">
          3. 所有上传信息我们均会妥善保管，不会用于其他商业用途或传输给第三方。
        </div>
      </div>
      <!-- 审核显示 -->
      <div v-show="showSuccess">
        <div class="successSubmit_box">
          <div class="img"></div>
          <div class="words">您的认证信息我们将会进行人工审核</div>
          <!-- <div class="words">您的基础信也会自动提交~</div> -->
          <div class="words">请耐心等待~</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
/**
 * 从 file 域获取 本地图片 url
 */

export default {
  data() {
    return {
      avatar: require("../../assets/img/license_compare.png"),

      active: 0,
      comName: "有限公司",
      personName: "Alan",
      position: "HR",
      phone: "1234567891",
      email: "@qq.com",
      scale: "1000人",
      showMain: true,
      showTop: true,
      showMyLic: false,
      showBusinessLic: false,
      pImage: true,
      showPImage: false,
      personImage: true,
      showPersonImage: false,
      showSuccess: false,

      form: {
        name: "",
        region: "",
      },
      imgNum: 4,
    };
  },

  methods: {
    next() {
      if (this.active++ > 2) this.active = 0;
    },
    last() {
      if (this.active-- <= 0) this.active = 0;
    },
    toMyLicense() {
      (this.showMain = false),
        (this.showTop = false),
        (this.showMyLic = true),
        (this.showBusinessLic = false),
        console.log(this.showBusinessLic);
    },
    toBusinessIdentify() {
      (this.showMain = false),
        (this.showTop = false),
        (this.showMyLic = false),
        (this.showBusinessLic = true),
        console.log(this.showBusinessLic);
    },
    toReturn() {
      (this.showMain = true),
        (this.showTop = true),
        (this.showMyLic = false),
        (this.showBusinessLic = false);
    },
    toHome() {
      this.$router.push("/home");
    },
    //企业认证的选择文件
    pickOne() {
      this.pImage = !this.pImage;
      this.showPImage = !this.showPImage;
    },
    pickTwo() {
      this.personImage = !this.personImage;
      this.showPersonImage = !this.showPersonImage;
    },
    //图片预览
    changeImage(e) {
      var file = e.target.files[0];
      var reader = new FileReader();
      var that = this;
      reader.readAsDataURL(file);
      reader.onload = function () {
        that.avatar = this.result;
      };
    },
    // 确认提交
    submitImage() {
      this.showSuccess = TextTrackCue;
      this.personImage = false;
      this.pImage = false;
      this.showPersonImage = false;
      this.showPImage = false;
      console.log(this.showSuccess);
    },
  },
};
</script>
<style lang="less" scoped>
/deep/.el-input--suffix .el-input__inner {
  font-size: 16px;
  letter-spacing: 1px;
  border: none;
  border-bottom: 1px solid #fff;
  border-radius: 10px;
  outline: none;
  background: rgba(240, 240, 240, 1);
}
.box {
  min-height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(
    to bottom,
    rgba(158, 178, 210),
    rgba(76, 108, 154, 1)
  ); /* 标准的语法 */
  .top {
    display: flex;
    flex-direction: column;
    width: 65%;
    height: auto;
    background: white;
    border-radius: 5px;
    padding: 0 10px 0 10px;
    background: rgb(247, 249, 250);
    .head {
      height: 60px;
      font-size: 18px;

      padding: 0px;
      line-height: 60px;

      font-weight: bold;
      .word {
        color: rgba(76, 108, 154, 1);
      }
    }
    .progress_bar {
      padding-top: 5px;
      padding-bottom: 8px;
      // background:red;
      border-bottom: 3px solid rgb(245, 245, 246);
      border-bottom-left-radius: 3px;
      border-bottom-right-radius: 3px;
      // border-image: linear-gradient(transparent,black, transparent)1 1;
      background: rgb(247, 249, 250);
    }
  }

  .main {
    display: flex;
    flex-direction: column;
    width: 65%;
    height: auto;
    background: white;
    border-radius: 5px;
    padding: 0 10px 0 10px;
    .content {
      .title {
        display: flex;
        align-items: center;
        margin-top: 8px;
        font-weight: bold;

        .bar {
          width: 3px;
          height: 16px;
          background: black;
          margin-right: 6px;
        }
      }

      .form {
        width: 100%;
        height: auto;
        display: flex;
        margin-top: 8px;
        color: black;

        justify-content: space-between;

        .right {
          // flex-grow: 1;
          display: flex;
          width: 40%;
          flex-direction: column;
          margin-right: 5px;
          span {
            color: red;
            display: inline-block;
            padding-left: 4px;
            padding-right: 3px;
          }
          .like-input {
            // height: 42px;
            // margin: 5px;
            display: inline-block;
            width: 95%;
            height: 40px;
            margin: 5px;
            //字不贴边
            padding-left: 10px;
            font-size: 16px;

            letter-spacing: 1px;
            /*字符间的间距1px*/
            // margin-bottom: 30px;
            border: none;
            border-bottom: 1px solid #fff;
            border-radius: 10px;
            outline: none;
            /*outline用于绘制元素周围的线*/
            // background: transparent;
            background: rgba(240, 240, 240, 1);
          }
          input {
            display: inline-block;
            width: 95%;
            height: 40px;
            margin: 5px;

            //字不贴边
            padding-left: 10px;
            font-size: 16px;

            letter-spacing: 1px;
            /*字符间的间距1px*/
            // margin-bottom: 30px;
            border: none;
            border-bottom: 1px solid #fff;
            border-radius: 10px;
            outline: none;
            /*outline用于绘制元素周围的线*/
            // background: transparent;
            background: rgba(240, 240, 240, 1);
            box-sizing: border-box;
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
          }
        }
        .left {
          // flex-grow: 1;
          display: flex;
          width: 40%;
          flex-direction: column;
          margin-left: 5px;
          span {
            color: red;
            display: inline-block;
            padding-left: 4px;
            padding-right: 3px;
          }
          input {
            display: inline-block;
            width: 95%;

            height: 40px;
            margin: 5px;
            //字不贴边
            padding-left: 10px;
            font-size: 16px;

            letter-spacing: 1px;
            /*字符间的间距1px*/
            // margin-bottom: 30px;
            border: none;
            border-bottom: 1px solid #fff;
            border-radius: 10px;
            outline: none;
            /*outline用于绘制元素周围的线*/
            // background: transparent;
            background: rgba(240, 240, 240, 1);

            /*背景颜色为透明*/
            box-sizing: border-box;
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
          }
        }
      }
    }
    .identify {
      margin-top: 30px;

      .words {
        margin-bottom: 30px;
        font-size: 18px;
        .ray {
          font-size: 16px;
          color: #888;
        }
        .red {
          font-size: 16px;
          line-height: 28px;
          color: #f44336;
          font-weight: bold;
        }
      }
      .main_box {
        width: 100%;
        margin-top: 60px;
        margin-bottom: 30px;
        min-height: 200px;
        display: flex;
        justify-content: space-around;

        .content_box {
          // cursor: pointer;
          position: relative;
          border: 1px solid #e5e6e6;
          height: 200px;
          width: 40%;

          .img {
            width: 63px;
            height: 63px;
            border: 1px solid #eee;
            border-radius: 50%;
            padding: 10px;
            position: absolute;
            left: 50%;
            //translate 参考自身进行平移，（x,y）(正数向右;负数向左,正数向下;负数向上)
            transform: translate(-50%, -50%);
            background-color: #fff;

            img {
              width: 100%;
              height: 100%;
              border-radius: 50%;
              background-color: #eee;
            }
          }
          .inner_box {
            width: 100%;
            height: 180px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            .big_words {
              font-size: 18px;
              color: #555555;
              margin-top: 40px;
              margin-bottom: 20px;
            }
            .small_words {
              font-size: 12px;
              color: #888888;
              margin-bottom: 15px;
            }
            .button {
              font: 400 13.3333px Arial;
              width: 30%;
              height: 40px;
              background: #ffffff;
              border: 1px solid #e5e6e6;
              font-size: 14px;
              color: #555555;
              border-radius: 4px;
              cursor: pointer;
            }
            .button:hover {
              background: rgb(38, 156, 228);
            }
          }
        }
        .content_box:hover {
          border: solid 1px rgb(38, 156, 228);
          background: #f8f9fe;

          .img {
            border: solid 1px rgb(38, 156, 228);
            background: #f8f9fe;
          }
          .button {
            background: #f8f9fe;
            border: 1px solid rgb(38, 156, 228);
          }
        }
      }
    }
    .success_box {
      margin-top: 50px;
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      .img {
        height: 100px;
        width: 100px;
        background: url("../../assets/img/success.png") no-repeat;
        background-size: cover;
        margin-bottom: 40px;
      }
      .words {
        margin-bottom: 15px;
        line-height: 30px;
        font-size: 16px;
        letter-spacing: 2px;
        color: #888;
      }
      .button_words {
        color: rgb(38, 156, 228);
        cursor: pointer;
      }
      .button_words:hover {
        text-decoration: underline;
      }
    }

    .bottom {
      width: 100%;
      height: 35px;
      text-align: center;
      line-height: 35px;
      border: solid 1px rgb(240, 240, 240);
      border-radius: 5px;
      margin: 10px 0 10px 0;
      cursor: pointer;
      background: rgb(210, 227, 250);
    }
    .bottom:hover {
      border: solid 1px rgb(82, 113, 258);
      background: rgb(153, 174, 204);
    }
    .bottom_new {
      width: 100%;
      height: 35px;
      background: transparent;
      display: flex;
      flex-direction: row;
      margin-bottom: 10px;
      margin: 10px 0 10px 0;
      .last {
        flex-grow: 1;
        text-align: center;
        height: 100%;
        width: 100%;
        line-height: 35px;
        border: solid 1px rgb(240, 240, 240);
        border-radius: 5px;

        cursor: pointer;
        background: rgb(210, 227, 250);
        margin-bottom: 10px;
      }
      .last:hover {
        border: solid 1px rgb(82, 113, 258);
        background: rgb(153, 174, 204);
      }
      .next {
        flex-grow: 1;
        text-align: center;
        width: 100%;
        height: 100%;
        line-height: 35px;
        border: solid 1px rgb(240, 240, 240);
        border-radius: 5px;

        cursor: pointer;
        background: rgb(210, 227, 250);
      }
      .next:hover {
        border: solid 1px rgb(82, 113, 258);
        background: rgb(153, 174, 204);
      }
    }
    .bottom_last {
      width: 100%;
      height: 35px;
      text-align: center;
      line-height: 35px;
      border: solid 1px rgb(240, 240, 240);
      border-radius: 5px;
      margin: 10px 0 10px 0;
      cursor: pointer;
      background: rgb(210, 227, 250);
    }
    .bottom_last:hover {
      border: solid 1px rgb(82, 113, 258);
      background: rgb(153, 174, 204);
    }
  }
  // 具体认证的盒子
  .identify_box {
    display: flex;
    flex-direction: column;
    width: 65%;
    min-height: 400px;
    background: white;
    border-radius: 5px;

    align-items: center;
    .title {
      width: 100%;
      padding-top: 15px;
      font-size: 18px;
      text-align: center;
      padding-bottom: 15px;
      font-weight: bold;
      background: rgb(247, 249, 250);
      color: rgba(76, 108, 154, 1);
    }
    .subTitle {
      margin-top: 5px;
      transform: translate(0, -150%);
      width: 100%;
      span {
        float: right;
      }
      .return {
        padding-right: 5px;
        color: rgb(46, 158, 255);
        font-size: 14px;
        font-weight: normal;
        float: right;
      }
      .return:hover {
        text-decoration: underline;
        cursor: pointer;
      }
    }

    .box_left {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      width: 400px;
      height: 400px;
      margin-top: 30px;
      border: 1px #e5e6e6 dashed;
      background: #f7f9fa;
      // position: relative;
      cursor: pointer;
      .box_inter {
        display: flex;
        width: 100%;
        height: 80%;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        .add {
          height: 35px;
          width: 35px;
          background: url(../../assets/img/add.png) no-repeat;
          background-size: cover;
        }
        .inter_words {
          width: auto;
          line-height: 30px;
          color: #888;
          font-size: 12px;
        }
      }

      .imageInfo {
        width: 400px;
        height: 80%;
        // background: red;
      }
      .box-bottom {
        display: flex;
        flex-direction: column;
        justify-content: space-between;

        height: 20%;
        // .chooseButton {
        //   width: 100%;
        // }
        .file-box {
          display: inline-block;
          position: relative;
          padding: 3px 5px;
          overflow: hidden;
          color: #fff;
          background-color: #ccc;
          .file-btn {
          
            width: 100%;
            height:10px ;
              position: absolute;
            top: 0;
            left: 0;
            // outline: none;
            // background-color: transparent;
           
            filter: alpha(opacity=0);
            -moz-opacity: 0;
            -khtml-opacity: 0;
            opacity: 0;
             background:rgb(46, 158, 255);
          border: solid 1px #e5e6e6;
          }
        }

        .button {
          display: inline-block;
          width: 100%;
          height: 30px;
          // background:rgb(46, 158, 255);
          border: solid 1px #e5e6e6;
          text-align: center;
          line-height: 30px;
          color: #888;
        }
        .button:hover {
          background: rgb(46, 158, 255);
        }
      }
    }

    .box_right {
      display: flex;
      padding-left: 30px;
      padding-right: 30px;
      flex-direction: column;
      width: 98%;
      margin-top: 30px;

      .words {
        width: auto;
        line-height: 36px;
        color: #888;
      }
    }
    .successSubmit_box {
      margin-top: 50px;
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      .img {
        height: 130px;
        width: 130px;
        background: url("../../assets/img/yes.png") no-repeat;
        background-size: cover;
        margin-bottom: 40px;
      }
      .words {
        margin-bottom: 15px;
        line-height: 30px;
        font-size: 16px;
        letter-spacing: 2px;
        color: #888;
      }
      .button_words {
        color: rgb(38, 156, 228);
        cursor: pointer;
      }
      .button_words:hover {
        text-decoration: underline;
      }
    }
  }
}
</style>